<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="addMenuForm">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">竞选标题：</label>
                            <div class="col-sm-8">
                                <input class="form-control" name="rname" type="text" placeholder="竞选标题">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">开始时间：</label>
                            <div class="col-sm-8">
                                <input class="form-control" onclick="WdatePicker()" name="starttime" type="text" placeholder="开始时间">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label" >结束时间：</label>
                            <div class="col-sm-8">
                                <input class="form-control" onclick="WdatePicker()" name="endtime" type="text" placeholder="结束时间">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">限制投票数：</label>
                            <div class="col-sm-8">
                                <input class="form-control" name="size" type="text" placeholder="限制投票数">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">状态：</label>
                            <div class="col-sm-8">
                                <input class="form-control" name="status"
                                       type="text" placeholder="0,1,2">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button type="button" class="btn btn-primary" onclick="save()">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>
</body>
<script>
    function save(){
        $.post("/title/save",$("#addMenuForm").serialize(),function(p){
            if(p.code==200){
                //添加成功！！
                parent.layer.close(parent.layer.getFrameIndex(window.name));
                parent.location.reload();
            }else{
                //添加失败！！
                parent.layer.msg('添加失败,'+p.msg(),{icon:2});
            }
        },"json");
    }
</script>
</html>
